<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h2>签到</h2>
<div>
    <a href="/signAddUI" target="_blank">我去签到</a>
    <h2>已经签到的数据：</h2>
    <button id="loadBtn">加载数据</button>
    <ul id="myUl">
        <li>没有数据</li>
    </ul>
</div>

<script src="../static/js/jquery.min.js"></script>

<script>
    //alert($("#myUl"));

    function initData(){
        console.log("加载数据...");
        $("#myUl").html("");
        $.ajax({
            url:"/list",
            data:"",
            success:function (res){
                console.log("success");
                let arr = $.parseJSON(res).data;
               if(arr &&arr.length > 0){
                   console.log("填充数据....");
                   $(arr).each(function (index,item){
                       // console.log(index);
                       // console.log(item);
                       $("#myUl").append("<li>" + index + ":" + JSON.stringify(item)  +  "</li>" );
                   })
               }
            },
            fail:function (res){
                console.log("fail");
                console.log(res);
            }
        })
    }

    //initData();

    $("#loadBtn").click(function (){
        initData();
    });

</script>
</body>
</html>